
AE_FORCEINLINE const AEVector4fComparison AE_CALL AEVector4fComparison::Convert( const AEVector4fMask &vcMask )
{
	AEVector4fComparison c;
	c.m_mMask = vcMask;
	return c;
}

AE_FORCEINLINE void AEVector4fComparison::SetAnd( AEVector4fConstRefCompParam vcComp1, AEVector4fConstRefCompParam vcComp2 )
{ 
	m_mMask = vcComp1.m_mMask & vcComp2.m_mMask; 
}

AE_FORCEINLINE void AEVector4fComparison::SetAndNot( AEVector4fConstRefCompParam vcComp1, AEVector4fConstRefCompParam vcComp2 )
{
	m_mMask = vcComp1.m_mMask & ( ~vcComp2.m_mMask );
}

AE_FORCEINLINE void AEVector4fComparison::SetXor( AEVector4fConstRefCompParam vcComp1, AEVector4fConstRefCompParam vcComp2 )
{
	m_mMask = vcComp1.m_mMask ^ vcComp2.m_mMask;
}

AE_FORCEINLINE void AEVector4fComparison::SetNot( AEVector4fConstRefCompParam vcComp )
{ 
	m_mMask = ( ~vcComp.m_mMask ) & AEVector4ComparisonMask::MASK_XYZW;
}

AE_FORCEINLINE void AEVector4fComparison::SetOr( AEVector4fConstRefCompParam vcComp1, AEVector4fConstRefCompParam vcComp2 )
{ 
	m_mMask = vcComp1.m_mMask | vcComp2.m_mMask;
}

AE_FORCEINLINE void AEVector4fComparison::SetSelect( AEVector4fConstRefCompParam vcComp, AEVector4fConstRefCompParam vcTrueValue, AEVector4fConstRefCompParam vcFalseValue )
{
	m_mMask = ( vcComp.m_mMask & vcTrueValue.m_mMask ) | ( ~vcComp.m_mMask & vcFalseValue.m_mMask );
}

template <AEVector4ComparisonMask::Mask M>
AE_FORCEINLINE void AEVector4fComparison::SetSelect( AEVector4fConstRefCompParam vcTrueValue, AEVector4fConstRefCompParam vcFalseValue )
{
	AE_VECTOR4FCOMPARISON_MASK_CHECK;
	m_mMask = ( M & vcTrueValue.m_mMask ) | ( ~M & vcFalseValue.m_mMask );
}

AE_FORCEINLINE void AEVector4fComparison::Set( Mask mMask )
{ 
	AEASSERT_MSG( ( mMask & 0xf ) == mMask, "illegal mask value handed in");
	m_mMask = mMask;
}

template <AEVector4ComparisonMask::Mask M>
AE_FORCEINLINE void AEVector4fComparison::Set( void )
{ 
	AE_VECTOR4FCOMPARISON_MASK_CHECK;
	m_mMask = M;
}

AE_FORCEINLINE AEBOOL32 AEVector4fComparison::AllAreSet( AEVector4ComparisonMask::Mask mMask ) const
{ 
	AEASSERT_MSG( ( mMask & 0xF ) == mMask, "illegal mask value handed in");
	return ( m_mMask & mMask ) == mMask;
}

template <AEVector4ComparisonMask::Mask M>
AE_FORCEINLINE AEBOOL32 AEVector4fComparison::AllAreSet( void ) const
{ 
	AE_VECTOR4FCOMPARISON_MASK_CHECK;
	if( M == MASK_NONE )
		return true;
	else if( M == MASK_XYZW )
		return m_mMask == MASK_XYZW;
	else
		return ( m_mMask & M ) == M;
}

AE_FORCEINLINE AEBOOL32 AEVector4fComparison::AnyIsSet( AEVector4ComparisonMask::Mask mMask ) const
{ 
	AEASSERT_MSG( ( mMask & 0xF ) == mMask, "illegal mask value handed in");
	return m_mMask & mMask;
}

template <AEVector4ComparisonMask::Mask M>
AE_FORCEINLINE AEBOOL32 AEVector4fComparison::AnyIsSet( void ) const
{ 
	AE_VECTOR4FCOMPARISON_MASK_CHECK;
	if( M == MASK_NONE )
		return false;
	else if( M == MASK_XYZW )
		return m_mMask;
	else
		return m_mMask & M;
}

AE_FORCEINLINE AEBOOL32 AEVector4fComparison::AllAreSet( void ) const
{ 
	return m_mMask == MASK_XYZW;
}

AE_FORCEINLINE AEBOOL32 AEVector4fComparison::AnyIsSet( void ) const
{ 
	return m_mMask;
}

AE_FORCEINLINE AEVector4ComparisonMask::Mask AEVector4fComparison::GetMask( void ) const 
{ 
	return (AEVector4ComparisonMask::Mask)(m_mMask);
}

AE_FORCEINLINE AEVector4ComparisonMask::Mask AEVector4fComparison::GetMask( AEVector4ComparisonMask::Mask mMask ) const 
{ 
	AEASSERT_MSG( ( mMask & 0xF ) == mMask, "illegal mask value handed in");
	return (AEVector4ComparisonMask::Mask)( m_mMask & mMask );
}

template <AEVector4ComparisonMask::Mask M>
AE_FORCEINLINE AEVector4ComparisonMask::Mask AEVector4fComparison::GetMask( void ) const 
{ 
	AE_VECTOR4FCOMPARISON_MASK_CHECK;
	return (AEVector4ComparisonMask::Mask)( m_mMask & M );
}

AE_FORCEINLINE AEUINT32 AE_CALL GetCombinedMask( AEVector4fConstRefCompParam vcMask1, AEVector4fConstRefCompParam vcMask2, AEVector4fConstRefCompParam vcMask3 )
{
	return vcMask1.m_mMask | ( vcMask2.m_mMask << 4 ) | ( vcMask3.m_mMask << 8 );
}

template <>
AE_FORCEINLINE const AEVector4fComparison AEVector4fComparison::HorizontalOr<1>( void ) const
{
	return AEVector4fComparison::Convert( (AEVector4fMask)( ( m_mMask & MASK_X ) ? MASK_XYZW : MASK_NONE ) );
}

template <>
AE_FORCEINLINE const AEVector4fComparison AEVector4fComparison::HorizontalOr<2>( void ) const
{
	return AEVector4fComparison::Convert( (AEVector4fMask)( ( m_mMask & MASK_XY ) ? MASK_XYZW : MASK_NONE ) );
}

template <>
AE_FORCEINLINE const AEVector4fComparison AEVector4fComparison::HorizontalOr<3>( void ) const
{
	return AEVector4fComparison::Convert( (AEVector4fMask)( ( m_mMask & MASK_XYZ ) ? MASK_XYZW : MASK_NONE ) );
}

template <>
AE_FORCEINLINE const AEVector4fComparison AEVector4fComparison::HorizontalOr<4>( void ) const
{
	return AEVector4fComparison::Convert( (AEVector4fMask)( m_mMask ? MASK_XYZW : MASK_NONE ) );
}

template <AEINT32 N>
AE_FORCEINLINE const AEVector4fComparison AEVector4fComparison::HorizontalOr( void ) const
{
	AE_VECTOR4FCOMPARISON_SUBINDEX_CHECK;
	AEVector4fComparison cmp;
	cmp.Set<AEVector4ComparisonMask::MASK_NONE>();
	return cmp;
}

template <>
AE_FORCEINLINE const AEVector4fComparison AEVector4fComparison::HorizontalAnd<1>( void ) const
{
	return AEVector4fComparison::Convert( (AEVector4fMask)( ( m_mMask & MASK_X ) ? MASK_XYZW : MASK_NONE ) );
}

template <>
AE_FORCEINLINE const AEVector4fComparison AEVector4fComparison::HorizontalAnd<2>( void ) const
{
	return AEVector4fComparison::Convert( (AEVector4fMask)( ( ( m_mMask & MASK_XY ) == MASK_XY ) ? MASK_XYZW : MASK_NONE ) );
}

template <>
AE_FORCEINLINE const AEVector4fComparison AEVector4fComparison::HorizontalAnd<3>( void ) const
{
	return AEVector4fComparison::Convert( (AEVector4fMask)( ( ( m_mMask & MASK_XYZ ) == MASK_XYZ ) ? MASK_XYZW : MASK_NONE ) );
}

template <>
AE_FORCEINLINE const AEVector4fComparison AEVector4fComparison::HorizontalAnd<4>( void ) const
{
	return AEVector4fComparison::Convert( (AEVector4fMask)( ( m_mMask == MASK_XYZW ) ? MASK_XYZW : MASK_NONE ) );
}

template <AEINT32 N>
AE_FORCEINLINE const AEVector4fComparison AEVector4fComparison::HorizontalAnd( void ) const
{
	AE_VECTOR4FCOMPARISON_SUBINDEX_CHECK;
	AEVector4fComparison cmp;
	cmp.Set<AEVector4ComparisonMask::MASK_NONE>();
	return cmp;
}

